Skip to content

feat(streaming): add error to LLMGatewayResponseEvent - #315

Draft
bgotthold-aai wants to merge 1 commit into
masterfrom
ben/llm-gateway-response-error
Draft

bgotthold-aai wants to merge 1 commit into
masterfrom
ben/llm-gateway-response-error

Conversation

@bgotthold-aai

Copy link
Copy Markdown
Contributor

The streaming API now always sends an LLMGatewayResponse for each turn sent to the LLM gateway, including when the gateway call fails (AssemblyAI/DeepLearning#24393). Failed turns carry a new error string, and data is the gateway's 4xx error body or null. Pydantic drops unknown fields, so today error never reaches SDK users. This adds error: Optional[str] = None to LLMGatewayResponseEvent, defaults data to None, and bumps the version to 1.10.13.

Gateway error:

{"type":"LLMGatewayResponse","turn_order":1,"transcript":"I'm calling about my Best Buy order.","data":{"metadata":{"errors":["model qwen3.5-4b-32k-fast is not supported"]},"request_id":"d5e3c268-257c-41f1-97b5-0de75037e723","message":"invalid request body","code":400},"error":"LLM Gateway returned 400: model qwen3.5-4b-32k-fast is not supported"}

Timeout:

{"type":"LLMGatewayResponse","turn_order":1,"transcript":"...","data":null,"error":"LLM Gateway request timed out"}

Tests: pytest -q tests/unit/test_streaming.py tests/unit/test_streaming_async.py (182 passed), ruff check and ruff format --check clean on changed files.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant